import axios from '@/utils/request'

// 采购申请列表
export const pageProcurement = (params) => {
  return axios({
    method: 'GET',
    url: 'procurementPlan/pageProcurement',
    params
  })
}
// 申请详情
export const procurementDetail = (procurementId) => {
  return axios({
    method: 'GET',
    url: `procurementPlan/procurementDetail/${procurementId}`
  })
}

// 删除申请
export const deleteProcurement = (procurementId) => {
  return axios({
    method: 'POST',
    url: `procurementPlan/deleteProcurement/${procurementId}`
  })
}

// 新增
export const submitProcurement = (data) => {
  return axios({
    method: 'POST',
    url: 'procurementPlan/submitProcurement',
    data
  })
}
// 编辑
export const reSubmitProcurement = (data) => {
  return axios({
    method: 'POST',
    url: 'procurementPlan/reSubmitProcurement',
    data
  })
}

// 获取材料下拉框
export const getMaterialAll = (params) => {
  return axios({
    method: 'GET',
    url: '/basicInfo/allMaterApprovalList',
    params
  })
}


export const totalProcurementAmount = (params) => {
  return axios({
    method: 'GET',
    url: '/procurementPlan/totalProcurementAmount',
    params
  })
}
export const getAllSuppliers=()=>{
  return axios({
    method:'GET',
    url:'/supplier/allSupplier'
  })
}


export const procurementApplyIsSelect=(applyId)=>{
  return axios({
    method:'GET',
    url:'/procurementPlan/procurementApplyIsSelect/'+applyId
  })
}

export function downloadMaterailTemplate () {
  return axios({
    url: '/procurementPlan/downLoadPlanOrderTemplate',
    method: 'GET',
    responseType: 'blob'
  })
}

export function exportPageProcurement () {
  return axios({
    url: '/procurementPlan/exportPageProcurement',
    method: 'GET',
    responseType: 'blob'
  })
}

export const findByCanCheckMaterail=(params)=>{
  return axios({
    method:'GET',
    url:'/stockCheck/findByCanCheckMaterail',
    params
  })
}
